#include <vcl.h>
#pragma hdrstop
#include "VectorPoint3D.h"
#pragma package(smart_init)
VectorPoint3D::VectorPoint3D(float x,float y,float z){
this->x=x;
this->y=y;
this->z=z;
}
//-----------------------------------------------------------------------
VectorPoint3D::~VectorPoint3D(){}
//-----------------------------------------------------------------------
VectorPoint3D::VectorPoint3D(){}
//-----------------------------------------------------------------------
float VectorPoint3D::getX(){
  return x;
}
//-----------------------------------------------------------------------
float VectorPoint3D::getY(){
  return y;
}
//-----------------------------------------------------------------------
float VectorPoint3D::getZ(){
  return z;
}
//-----------------------------------------------------------------------
void VectorPoint3D::setX(float x){this->x=x;}
//-----------------------------------------------------------------------
void VectorPoint3D::setY(float y){this->y=y;}
//-----------------------------------------------------------------------
void VectorPoint3D::setZ(float z){this->z=z;}
//--------------------------------------------------------------------
void VectorPoint3D:: setPunto(float x,float y,float z){
this->x = x;
this->y = y;
this->z = z;
}
//----------------------------------------------------
float VectorPoint3D:: getAngle(){
float coseno = x/module();
float arcoaux = acos(coseno);
if (y<0) arcoaux = -arcoaux;
return arcoaux;
}
//-----------------------------------------------------------
float VectorPoint3D:: module(){
float value = pow(x,2)+pow(y,2)+ pow(z,2);
value = sqrt(value);
return value;
}
//------------------------------------------------------------------
void VectorPoint3D:: normalice()
{
float module = this->module();
if(module != 0){
    x=x*(1/module);
    y=y*(1/module);
    z=z*(1/module);
    }
}

//---------------------------------------------------
 float VectorPoint3D::prodEscalar(VectorPoint3D* p){
      float aux=((x*p->getX())+(y*p->getY())+(z*p->getZ()));
      return aux;
 }
//------------------------------------------------------------------
VectorPoint3D* VectorPoint3D::prodVectorial(VectorPoint3D* a){
  float u = (y * a->getZ()) - (z * a->getY());
  float v = (z * a->getX()) - (x * a->getZ());
  float w = (x * a->getY()) - (y * a->getX());

  return new VectorPoint3D(u,v,w);
}


